package com.me.helper;

import java.util.ArrayList;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;

public class SoundManager {
	private static float volumeSound = 1;
	
	public static boolean PLAY_MUSIC = true;
	public static boolean PLAY_SOUND = true;
	
	private Sound sd1, sd2, sd3;
	private static ArrayList<Sound> arraySound;
	
	public static int SOUND_DUCK_1 = 0;
	public static int SOUND_DUCK_2 = 1;
	public static int SOUND_DUCK_3 = 2;
	
//	private Music mMenu, mPlay;
	private static ArrayList<Music> arrayMusic;
//	public static int MUSIC_MENU = 0;
//	public static int MUSIC_PLAY = 1;
	
	public SoundManager() {
		super();
		initSound();
		initMusic();
	}
	
	private void initSound(){
//		sd1 = Gdx.audio.newSound(Gdx.files.internal("sound/sd1.mp3"));
//		sd2 = Gdx.audio.newSound(Gdx.files.internal("sound/sd2.mp3"));
//		sd3 = Gdx.audio.newSound(Gdx.files.internal("sound/sd3.mp3"));
//		arraySound = new ArrayList<Sound>(3);
//		arraySound.add(sd1);
//		arraySound.add(sd2);
//		arraySound.add(sd3);
//		
//		arrayMusic = new ArrayList<Music>();
	}
	
	private void initMusic(){
//		mMenu = Gdx.audio.newMusic(Gdx.files.internal("sound/menu.mp3"));
//		mPlay = Gdx.audio.newMusic(Gdx.files.internal("sound/play.mp3"));
//		arrayMusic = new ArrayList<Music>(2);
//		arrayMusic.add(mMenu);
//		arrayMusic.add(mPlay);
	}
	
	public static void playSound(int iSound){
		arraySound.get(iSound).play(volumeSound);
	}
	
//	public static void playMusic(int iMusic){
//		for (Music m : arrayMusic){
//			m.stop();
//		}
//		arrayMusic.get(iMusic).setLooping(true);
//		arrayMusic.get(iMusic).play();
//	}
	
	public static void setVolumeMusic(float v){
		for (int i = 0; i < arrayMusic.size() ; i++)
			arrayMusic.get(i).setVolume(v);
	}
	
	public static void setVolumeSound(float volume){
		volumeSound = volume;
	}
}
